<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    x:Class="OpenLS.Spreadsheet.UI.CellStyleResources"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:ss="http://schemas.Kherty.com/office/2007/spreadsheet"
  xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI"
  xmlns:drawing2="clr-namespace:OpenLS.Drawing.UI;assembly=OpenLS.Drawing.UI"
  xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals">
    <ssui:BorderStyleToThicknessConverter x:Key="borderStyleToThicknessConverter"/>
    <DataTemplate DataType="{x:Type ss:CellStyle}">
        <Grid ToolTip="{Binding Name}" Width="100" MinHeight="26" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <!--<Grid.Background>
                <MultiBinding >
                    <MultiBinding.Converter>
                        <Internals:FillToBrushConverter DefaultBrush="White" />
                    </MultiBinding.Converter>
                    <Binding Path="Background"></Binding>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
                </MultiBinding>
            </Grid.Background>-->
            <Rectangle Grid.RowSpan="3" Grid.ColumnSpan="3" Fill="White"></Rectangle>
            <Rectangle Grid.RowSpan="3" Grid.ColumnSpan="3">
                <Rectangle.Fill>
                    <MultiBinding>
                    <MultiBinding.Converter>
                        <Internals:FillToBrushConverter DefaultBrush="White" />
                    </MultiBinding.Converter>
                    <Binding Path="Background"></Binding>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle Grid.ColumnSpan ="3" Grid.Row ="2" Height ="{Binding Path=Borders.Bottom.Style, Converter={StaticResource borderStyleToThicknessConverter}}">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.ColorToBrushConverter}">
                        <Binding Path="Borders.Bottom.Color"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>

            <Rectangle Grid.ColumnSpan ="3" Grid.Row ="0" Height ="{Binding Path=Borders.Top.Style, Converter={StaticResource borderStyleToThicknessConverter}}">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.ColorToBrushConverter}">
                        <Binding Path="Borders.Top.Color"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle Grid.RowSpan ="3" Grid.Column ="2" Width ="{Binding Path=Borders.Right.Style, Converter={StaticResource borderStyleToThicknessConverter}}">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.ColorToBrushConverter}">
                        <Binding Path="Borders.Right.Color"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle Grid.RowSpan ="3" Grid.Column ="0" Width ="{Binding Path=Borders.Bottom.Style, Converter={StaticResource borderStyleToThicknessConverter}}">
                <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.ColorToBrushConverter}">
                        <Binding Path="Borders.Left.Color"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
                </Rectangle.Fill>
            </Rectangle>

            <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Name}" FontStyle="{Binding FontStyle}"  VerticalAlignment="Center"
                 FontWeight="{Binding FontWeight}" FontFamily ="{Binding FontFamily}"
                 FontSize="{Binding FontSize, Converter={x:Static ss:PointsToPixelConverter.Instance}}" Margin="2 0 0 0">
       <!-- <TextBlock.Background>
          <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.FillToBrushConverter}">
            <Binding Path="Background"></Binding>
            <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
          </MultiBinding>
        </TextBlock.Background> -->
        <TextBlock.Foreground>
          <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.ColorToBrushConverter}">
            <Binding Path="Foreground"></Binding>
            <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
          </MultiBinding>
        </TextBlock.Foreground>

            </TextBlock>
        </Grid>
    </DataTemplate>

</ResourceDictionary>